import axios from 'axios';
import { baseUrl, apiUrl } from '../config/api.config';

/**
 * axios基础配置
 */
if (process.env.NODE_ENV === 'development') {
  axios.defaults.baseURL = baseUrl.dev;
} else {
  axios.defaults.baseURL = baseUrl.pro;
}
axios.defaults.timeout = 20000;

function request(url, params) {
  // const data = Object.assign(params || {}, { /*realIP: '192.25.146.178'*/});
  return axios.get(url, { params: params }).then(res => res.data);
}

export { request, apiUrl };
